const koa = require('koa');
const router = require('koa-router');

let server = new koa();
server.listen(8080);

const r1 = router()
server.use(r1.routes());

r1.get('/aaa', async (ctx, next) => {
    console.log(ctx);
    ctx.response.body = 'abc';   // 发送回客户端的内容，也可以写对象或数组
    ctx.response.set('z',12);   // 自定义头信息
    ctx.response.status = 403;   // 设置状态码   
});